 #include<bits/stdc++.h>
using namespace std;
#include<stack>
int judge(char ch1,char ch2);
int main(){
	char a[100],postexp[30];
	int i,j=0;
	gets(a);
	stack<char> s;
	for(i=0;a[i];i++){
		if(a[i]=='.') {
			postexp[j]=a[i];
			j++;
			continue;
		}
	/*	else if(a[i]=='(') {
			s.push(a[i]);
			continue;
		}*/
		else if(a[i]>='0'&&a[i]<='9'){
			if(a[i+1]>='0'&&a[i+1]<='9'){
			postexp[j]=a[i];
			j++;
			postexp[j]='#';
			j++;
			}
			else {
				postexp[j]=a[i];
				j++;
			}
			continue;
		}
		else if(a[i]=='+'&&a[i+1]>='0'&&a[i+1]<='9'&&(i==0||a[i-1]=='+'||a[i-1]=='-'||a[i-1]=='*'||a[i-1]=='/'||a[i-1]=='(')){
			continue;
		}
		else if(a[i]=='-'&&a[i+1]>='0'&&a[i+1]<='9'&&(i==0||a[i-1]=='+'||a[i-1]=='-'||a[i-1]=='*'||a[i-1]=='/'||a[i-1]=='(')){
			postexp[j]=a[i];
			j++;
			postexp[j]='#';
			j++;
			continue;
		}
		else if(s.empty()){
			s.push(a[i]);
			continue;
		}
		else if(judge(s.top(),a[i])==1){
			s.push(a[i]);
			continue;
		}
		else if(judge(s.top(),a[i])==0){
			if(a[i]==')'){
				while(!s.empty()&&s.top()!='('){
					postexp[j]=s.top();
					j++;
					s.pop();
				}
				if(!s.empty()&&s.top()=='(') s.pop();
			}
			else {
				while(!s.empty()&&s.top()!='('){
					postexp[j]=s.top();
					j++;
					s.pop();
				}
				s.push(a[i]);
			}
		}
	}
	while(!s.empty()){
		postexp[j]=s.top();
		j++;
		s.pop();
	}
	postexp[j]='\0';
	for(j=0;postexp[j];j++){
		if(postexp[j]=='#') {
			cout<<postexp[j+1];
			j++;
		}
		else if(postexp[j]=='.'){
			cout<<'.'<<postexp[j+1];
			j++;
		}
		else if(j==0) cout<<postexp[j];
		else cout<<" "<<postexp[j];
	}
}
int judge(char ch1,char ch2){
	if(ch1=='('&&ch2==')') return 0;
	if(ch1=='('||ch2=='('){
		return 1;
	}
	else if(ch1=='+'||ch1=='-'){
		if(ch2=='+'||ch2=='-'){
			return 1;
		}
		else if(ch2=='*'||ch2=='/'){
			return 1;
		}
		else if(ch2==')'){
			return 0;
		}
	}
	else if(ch1=='*'||ch1=='/'){
		if(ch2=='*'||ch2=='/'){
			return 1;
		}
		else if(ch2=='+'||ch2=='-') {
			return 0;
		}
		else if(ch2==')'){
			return 0;
		}
	}
}
